import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';

import { segmentInlineDefaultProps } from './defaultProps';
import type { SegmentInlineOptions } from './type';

export interface SegmentInlineProps extends SegmentInlineOptions, HTMLAttributes<HTMLDivElement> {}

const SegmentInline: FC<SegmentInlineProps> = (props) => {
  const { className, children, forwardedRef, ...segmentInlineProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames('inline', className), ...segmentInlineProps },
    children,
  );
};

SegmentInline.displayName = 'SegmentInline';
SegmentInline.defaultProps = segmentInlineDefaultProps;

export default SegmentInline;
